package com.rd.student.jiaji.class4.suyan.zrrd.day17;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class HashMapTest {
    private static String value;

    public static void main(String[] args) {
        HashMap hashMap=new HashMap();
        hashMap.put("01",0);
        hashMap.put("02",0);
        hashMap.put("03",0);
        hashMap.put("04",0);
        hashMap.put("05",0);
        hashMap.put("06",0);
        System.out.println(hashMap.size());
        info(hashMap);
        System.out.println("-------------");
        hashMap.put("01",5);
        hashMap.put("02",7);
        hashMap.put("03",8);
        hashMap.put("04",6);
        hashMap.put("05",7);
        hashMap.put("06",5);

        int num =(int)hashMap.get("02");
        System.out.println(num);
//        Object num1=hashMap.get("07");
//        if (num1==null){
//            int num11=(int)num1;
//            System.out.println(num11);
//        }
        String key="02";
        System.out.println(hashMap.containsKey(key));
        hashMap.remove(key);
        System.out.println(hashMap.containsKey(key));
        info(hashMap);
//在村日数据 查询数据 删除数据 操作的都是key

    }
    public static void info(HashMap hashMap){
        //因为所有的key都不能重复 所以key组成了一个set
        Set set =hashMap.keySet();
        Iterator iterator=set.iterator();
        while (iterator.hasNext()){
            Object key=iterator.next();
            Object value=hashMap.get(key);
            System.out.println("<"+key+","+value+">");
        }
    }









}
